home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / General / LineShare Folder / Put Onto Productions Disks / LineShare Scripts / Pro⁄Ultima VoiceFax&ARA < prev    next >
Text File  |  1994-03-08  |  6KB  |  299 lines

  1. ! Version 2.2
  2. !
  3. !$ Use with: Prometheus Ultima Home Office modems.
  4. !
  5. !$ Supports: MaxFax voice/fax and ARA
  6. !
  7. !$ In MaxFax, set "Rings till answer" to 1, "Toll Saver" to 0.
  8. !
  9. !$ To access the ARA host, extend the phone number with
  10. !$ 8 commas and 1-3 "Data Link Codes" separated with commas.
  11. !
  12. !$ Sample: "555-234,,,,,,,,5,5,5".
  13.  
  14. ^2 Speaker On:        = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
  15. ^3 Speaker Volume:       = Enum("Low"="1","Medium"="2","High"="3") "2"
  16. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  17. ^5 Fax Identifier:    = Text "Stalker"
  18. ^6 Data Line Code:    = Enum("1"="","2"="","3"="","4"="","5"="","6"="","7"="","8"="","9"="") ""
  19. ! ------------------------------------------
  20. ! Resetting the modem:
  21. ! ------------------------------------------
  22. @Hangup
  23.   Note "Resetting" 3
  24.   SetTries 2
  25.   Flush
  26.   HsReset 0,0,17,19,0,0
  27. !
  28. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  29. ! to enter the command mode
  30. !
  31. @Label 1
  32.   matchclr
  33.   matchstr 1 2 "OK\r\n"
  34.   write "ATH0&F\r"
  35.   matchread 20
  36.   ChrDelay 1
  37.   Write "+++"
  38.   ChrDelay 0
  39.   DtrClear
  40.   pause 5
  41.   DtrSet
  42. !
  43.   SerReset 19200,0,8,1
  44.   DecTries
  45.   IfTries 1 1
  46.   SerReset 9600,0,8,1
  47.   IfTries 0 1
  48. !
  49. ! OSErr -6019 "Modem error - the modem is not responding"
  50. !
  51.   exit -6019
  52. @Label 2
  53.   SerReset 9600,0,8,1
  54.   write "AT+FCLASS=0\r"
  55.   Jsr 100
  56.   write "AT+FAA=0\r"
  57.   Jsr 100
  58.   Flush
  59.   Write "ATI9\r"
  60.   MatchClr
  61.   MatchStr 1 3 "\r\n^$\r\n\r\nOK\r\n" 
  62.   MatchStr 2 4 "ERROR\r\n"
  63.   MatchRead 5
  64.   Jump 4
  65. @Label 3
  66.   SetInfo 9 "^$"
  67. @Label 4
  68.   exit 0
  69.  
  70. ! ------------------------------------------
  71. !    Receiving incoming calls
  72. ! ------------------------------------------
  73. @ANSWER
  74. !
  75. ! Set the modem preferred speed first
  76. !
  77.   SerReset 19200,0,8,1
  78.   Jsr 80
  79. @Label 10
  80. !
  81. ! Set the common options
  82.   Jsr 70
  83.  
  84. !  Write "AT+FAA=1\r"
  85. !  Jsr 100
  86. !
  87. ! Everything is ready - let's sit and wait for a call
  88. ! We'll wait for 5 minutes, then reinitiate the modem
  89. !
  90.   Note "Waiting for a fax/voice or ARA call…"
  91.   SetTries 0
  92. @Label 15
  93.   MatchClr
  94.   matchstr 1 16 "RING\r\n"
  95.   Matchread 100
  96.   IfTries 1 10
  97.   MatchRead 2900
  98.   Jump 10
  99. @Label 16
  100.   Note "Ring…"
  101.   IncTries
  102.   IfTries Val("^4") 19
  103.   Jump 15
  104. @Label 19
  105.   ifOpen "MaxFax" 20
  106.   Jump 25
  107.  
  108. @Label 20
  109. ! A = <dle> 0x11 <digit code>
  110. ! B = 0x1F (* code)
  111. !
  112.   SetVar A "\16\17^6"
  113.   SetVar B "\31\r\nOK\r\n"
  114.   QueueInput "\r\nRING\r\n\r\nRING\r\n"
  115.   HsReset 0,1,0,0,0,0
  116.   Attach "MaxFax" (DTR,Escape,Master,Check(A,B))
  117.   Pause 5
  118. !
  119. !now abort greetings, if any in progress
  120.   Write "\16\03"
  121.   MatchClr
  122.   MatchStr 1 23 "OK\r\n"
  123.   MatchRead 40
  124. @Label 23
  125.   Flush
  126.   HsReset 0,1,0,0,0,0
  127.   Write "AT\r"
  128.   Jsr 100
  129. !
  130. ! switch off voice modes
  131.   Write "AT#VS0\r"
  132.   Jsr 100
  133.   SerReset 2400,0,8,1
  134.   Write "AT\r"
  135.   Jsr 100
  136.   SerReset 19200,0,8,1
  137.  
  138.   Write "AT#VH0H1\r"
  139.   Jsr 100
  140.  
  141.   Write "AT+FAA=0;+FCLASS=0\r"
  142.   Jsr 100
  143. !
  144. ! Set the common options
  145.   Jsr 70
  146.  
  147. !
  148. ! Set ARA parameters, force to answer in the data mode
  149. @Label 25
  150.   Write "AT\\N0A\r"
  151.   MatchClr
  152.   MatchStr 1 30 "\r\nCONNECT ^$\r\n"
  153.   MatchStr 4 93 "NO CARRIER\r\n"
  154.   MatchStr 5 94 "NO ANSWER\r\n"
  155.   MatchRead 300
  156.   Write "\r"
  157.   Exit -6019
  158.  
  159.  
  160. @Label 30
  161.   QueueInput "\r\nCONNECT ^$\r\n"
  162.   QueueInput "\r\nRING\r\n"
  163.   Attach "ARA" (DTR,Break)
  164.  
  165. ! ------------------------------------------
  166. ! Originating a call through the "ARA" subport
  167. ! ------------------------------------------
  168. @ORIGINATE "ARA"
  169.   SerReset 19200,0,8,1
  170.   Jsr 80
  171. !
  172. ! Set the common options
  173. !
  174.   Jsr 70
  175. !
  176.   Write "AT\\N0\r"
  177.   Jsr 100
  178.   Jsr 60
  179. !
  180. ! Prepare to receive all error result codes, dial the number
  181. !
  182.   Jsr 90
  183.   MatchStr 1 35 "\r\nCONNECT"
  184.   MatchRead 1000
  185.   Write "\r"
  186.   Exit -6019
  187.  
  188. @Label 35
  189.   QueueInput "\r\nCONNECT"
  190.   Attach "ARA" (DTR,Break)
  191.  
  192. ! ------------------------------------------
  193. ! Originating a call through the "MaxFax" subPort
  194. ! ------------------------------------------
  195. @ORIGINATE "MaxFax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
  196. !
  197. ! Set the "Fax" speed
  198. !
  199.   SerReset 19200,0,8,1
  200.   Jsr 80
  201. !
  202. ! Set the common options
  203. !
  204.   Jsr 70
  205. !
  206. ! Set the Fax mode
  207. !
  208.   Write "AT+FCLASS=2\r"
  209.   Jsr 100
  210. !
  211. ! Now emit all commands that the application has sent to that port, except +FCLASS
  212. !
  213.   EmitClear "+FCLASS"
  214.   Jsr 60
  215. !
  216. ! Prepare to receive all error result codes, dial the number
  217. !
  218.   Jsr 90
  219.   HSReset 0 1 0 0 0 0
  220.   MatchStr 1 40 "\r\n+FCON"
  221.   MatchRead 900
  222.   Write "\r"
  223.   Exit -6019
  224. @Label 40
  225.   QueueInput "\r\n+FCON"
  226.   Attach "MaxFax" (DTR,Escape)
  227.  
  228. !
  229. ! This section emits all modem commands sent from the client application
  230. ! For each set of commands the "OK" answer is awaited
  231. !
  232. @Label 60
  233.   EmitStart
  234. @Label 61
  235.   EmitCommand 62
  236.   Jsr 100
  237.   Jump 61
  238. @Label 62
  239.   return
  240. !
  241. ! This section initiates the modem before ANSWER and ORIGINATEs:
  242. ! extended responses + connect at the highest rate + speaker control +
  243. ! reset on Dtr drop 
  244. ! Verbal responses mode, no echo 
  245. !
  246. @Label 70
  247.   Write "ATX4M^2L^3&D2V1E0\r"
  248.   Jump 100
  249.  
  250. @Label 75
  251.   Write "AT\\Q2W0S95=1\r"
  252.   Jump 100
  253.  
  254. !
  255. ! This section syncronize the modem after the serial port speed switching
  256. !
  257. @Label 80
  258.   ChrDelay 1
  259.   Write "AT\r"
  260.   ChrDelay 0
  261.   Jsr 100
  262.   return
  263. !
  264. ! Prepare to receive error result codes, send the dialing command and
  265. ! set the user's handshake mode
  266. !
  267. @Label 90
  268.   MatchClr
  269.   MatchStr 2 91 "NO DIALTONE\r\n"
  270.   MatchStr 3 92 "BUSY\r\n"
  271.   MatchStr 4 93 "NO CARRIER\r\n"
  272.   MatchStr 5 94 "NO ANSWER\r\n"
  273.   Write "ATD^1\r"
  274.   HsReset *
  275.   return
  276. @Label 91
  277.   exit -6020
  278. @Label 92
  279.   exit -6022
  280. @Label 93
  281.   exit -6021
  282. @Label 94
  283.   exit -6023
  284. !
  285. ! Processing the AT command:
  286. ! OK -> proceed
  287. ! ERROR or TimeOut ->exit -6019
  288. ! It can be called AFTER the "Write" command, since LineShare buffers input
  289. !
  290. @Label 100
  291.   MatchClr
  292.   MatchStr 1 102 "\r\nOK\r\n"
  293.   MatchStr 2 101 "\r\nERROR\r\n"
  294.   MatchRead 20
  295. @Label 101
  296.   Exit -6019
  297. @Label 102
  298.   return
  299.